package com.wmg.exception;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.jws.WebParam;


/**
 * 统一异常处理类
 */
@ControllerAdvice
public class GlobalExceptionHandler {

	@ExceptionHandler(Exception.class)
	@ResponseBody
	public ModelAndView error(Exception e){
		e.printStackTrace();
		ModelAndView mv = new ModelAndView("error/error");
		return mv;
	}
	//自定义异常处理方法
	@ExceptionHandler(NotFoundException.class)
	@ResponseBody
	public String error(NotFoundException e){
		e.printStackTrace();
		return "执行了自定义异常处理....";
	}
}